package com.test.controller;

import org.springframework.web.bind.annotation.*;

/**
 * Created by apple on 2017/5/11.
 */

@RestController
@RequestMapping("/data")
public class DataController {
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
//    @GetMapping// 等价
    String home(@PathVariable("id") Integer id) {
        return "index = " + id;
    }

    @RequestMapping(value = {"/", ""}, method = RequestMethod.GET)
    String index(@RequestParam(value = "id", required = false, defaultValue = "1") Integer myid) {
        return "index = " + myid;
    }
}
